var ajaxHelper = require("../../utils/ajaxhelp");
const serviceUrl = getApp().globalData.serviceUrl;
let token =wx.getStorageSync('token');

const getScreenCallBackResult = (taskId,screenId) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCallBack/GetScreenCallBackResult", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		taskId: taskId,
		screenId:screenId
	})
}

const createCallBackResult = (callbackResult={}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCallBack/CreateCallBackResult", {
		'Authorization': 'Bearer ' + token
	}, "POST", callbackResult)
}

const updateScreenCallBacksData = (screenCallBackModel={}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCallBack/UpdateScreenCallBacksData", {
		'Authorization': 'Bearer ' + token
	}, "POST", screenCallBackModel)
}

const UpdateScreenCallBacksDelay = (screenCallBackModel={},delayDay) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCallBack/UpdateScreenCallBacksDelay?delayDay="+delayDay, {
		'Authorization': 'Bearer ' + token
	}, "POST", screenCallBackModel)
}

const GetScreenCallBackByLeadId = (leadId) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenCallBack/GetScreenCallBackByLeadId", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		leadId: leadId
	})
}

module.exports = {
	getScreenCallBackResult,
	createCallBackResult,
	updateScreenCallBacksData,
	GetScreenCallBackByLeadId,
	UpdateScreenCallBacksDelay
}